<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('gzmx_scdw列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>点位名称：</label>
                                <input type="text" name="dwmc"/>
                            </li>
                            <!-- 
                            <li>
                                <label>级别：</label>
                                <input type="text" name="jb"/>
                            </li>
                            <li>
                                <label>父点位代码：</label>
                                <input type="text" name="fdwdm"/>
                            </li>
                            <li>
                                <label>单位ID：</label>
                                <input type="text" name="deptId"/>
                            </li>
                            <li>
                                <label>用户ID：</label>
                                <input type="text" name="userId"/>
                            </li>
                            <li>
                                <label>二级单位ID：</label>
                                <input type="text" name="ejdwId"/>
                            </li>
                            <li>
                                <label>二级单位名称：</label>
                                <input type="text" name="ejdwName"/>
                            </li>
                            <li>
                                <label>作业区ID：</label>
                                <input type="text" name="zyqId"/>
                            </li>
                            <li>
                                <label>作业区名称：</label>
                                <input type="text" name="zyqName"/>
                            </li>
                             -->
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="gzmx_scdw:gzmx_scdw:add">
                    <i class="fa fa-plus"></i> 新增
                </a>
                <a class="btn btn-primary" onclick="$.operate.edit()" shiro:hasPermission="gzmx_scdw:gzmx_scdw:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-info" id="expandAllBtn">
                    <i class="fa fa-exchange"></i> 展开/折叠
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-tree-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var addFlag = [[${@permission.hasPermi('gzmx_scdw:gzmx_scdw:add')}]];
        var editFlag = [[${@permission.hasPermi('gzmx_scdw:gzmx_scdw:edit')}]];
        var removeFlag = [[${@permission.hasPermi('gzmx_scdw:gzmx_scdw:remove')}]];
        var prefix = ctx + "gzmx_scdw/gzmx_scdw";

        $(function() {
            var options = {
                code: "id",
                parentCode: "fdwdm",
                expandColumn: "2",
                uniqueId: "id",
                url: prefix + "/list",
                createUrl: prefix + "/add/{id}",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove/{id}",
                expandAll:false,
                expandFirst:false,
                modalName: "gzmx_scdw",
                columns: [{
                    field: 'selectItem',
                    radio: true
                },
                {
                    field: 'id',
                    title: '点位ID',
                    align: 'left',
                    //visible: false
                },
                {
                    field: 'dwmc',
                    title: '点位名称',
                    align: 'left'
                },
                {
                    field: 'jb',
                    title: '级别',
                    align: 'left'
                },
                {
                    field: 'fdwdm',
                    title: '父点位代码',
                    align: 'left',
                    visible: false
                },
                {
                    field: 'deptId',
                    title: '单位ID',
                    align: 'left',
                    visible: false
                },
                {
                    field: 'userId',
                    title: '用户ID',
                    align: 'left',
                    visible: false
                },
                {
                    field: 'ejdwId',
                    title: '二级单位ID',
                    align: 'left',
                    visible: false
                },
                {
                    field: 'ejdwName',
                    title: '二级单位名称',
                    align: 'left',
                    visible: false
                },
                {
                    field: 'zyqId',
                    title: '作业区ID',
                    align: 'left',
                    visible: false
                },
                {
                    field: 'zyqName',
                    title: '作业区名称',
                    align: 'left',
                    visible: false
                },
                {
                    title: '操作',
                    align: 'center',
                    align: 'left',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if(row.jb==2){
                       	   // actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                            actions.push('<a class="btn btn-info  btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.id + '\')"><i class="fa fa-plus"></i>新增</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');	
                       }
                        if(row.jb>2&&row.jb<5){
                        	 actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                             actions.push('<a class="btn btn-info  btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.id + '\')"><i class="fa fa-plus"></i>新增</a> ');
                             actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');	
                        }
                        if(row.jb==5){
                       	    actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                            //actions.push('<a class="btn btn-info  btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.id + '\')"><i class="fa fa-plus"></i>新增</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');	
                       	    actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="open_gzmx_tag(\'' + row.id + '\')"><i class="fa fa-edit"></i>采集点位维护</a> ');

                        }
                       
                        return actions.join('');
                    }
                }]
            };
            $.treeTable.init(options);
        });
        
        function open_gzmx_tag(str_id) {
        	
    		$.modal.openTab("添加采集点位","/gzmx_tag/gzmx_tag/gzmx_tag/"+str_id);	

        	
        }
    </script>
</body>
</html>